const cameraService = require('../../service/web/CameraService')
const { myAssert } = require('../../utils')
module.exports = ({ app, router }) => {

    router.get('/cameras', async (req, res) => {
        // const camera = {
        //     name: '摄像头3',
        //     host: '192.168.0.102',
        //     port: 81,
        //     username: 'admin',
        //     password:'hyl102700',
        //     location: '江苏省南京市浦口区'
        // }
        // req.Model.create(camera);
        myAssert(await cameraService.getCamerasService(req), res, "摄像头列表获取失败！")
    });
    router.post('/startRTSPStream', async (req, res) => {
        myAssert(await cameraService.startRTSPStreamService(app, req), res, "摄像头RTSP流开启失败！")
    });
    router.post('/stopRTSPStream', async (req, res) => {
        myAssert(await cameraService.closeRTSPStreamService(app, req), res, "摄像头RTSP流关闭失败！")
    });
    router.post('/snapshotRTSPStream', async (req, res) => {
        myAssert(await cameraService.snapshotRTSPStreamService(app, req), res, "摄像头RTSP流截图失败！")
    })
    router.post('/recordRTSPStream', async (req, res) => {
        myAssert(cameraService.recordRTSPStreamService(app, req), res, "摄像头RTSP流录像失败！")
    })
}